sum=0
for i in range(1,5):
    for j in range(1,5):
        if i==j:
            continue
        else:
            for k in range(1,5):
                if k==i or k==j:
                    continue
                else:
                    print(str(i)+str(j)+str(k),end='  ')
                    sum=sum+1
print('')
print("总计有"+str(sum)+"个数")